<template>
    <div class="newsInfoContainer">
        <h3 class="title">{{newsinfo.title}}</h3>
        <p class="subTitle">
            <span>发表时间：{{newsinfo.publishTime}}</span>
            <span>浏览量：{{newsinfo.pageView}}</span>
        </p>

        <hr>

        <img :src="newsinfo.imgUrl">
        <div class="content">{{newsinfo.content}}</div>

        <comment-box v-bind="post"></comment-box>
    </div>
</template>

<script>
import Comment from '../publiccomponents/Comment.vue'
import {Toast} from 'mint-ui'
export default {
    data() {
        return {
            id: this.$route.params.id,
            newsinfo: {},
            pageNumber: 0,
            post: {
                pathurl: '/admin/comment/commentList',
                type: 1,
                id: this.$route.params.id
            }
        }
    },
    created() {
        this.getNewsInfo();
    },
    methods: {
        getNewsInfo(){
            this.axios.get('/admin/new/newsInfo/'+this.id).then(response => {
                if(response.data.success){
                    this.newsinfo = response.data.data;
                } else {
                    Toast('加载失败');
                }
            })
        },
    },
    components: {
        'comment-box': Comment
    }
}
</script>

<style lang="scss" scoped>
.newsInfoContainer{
    padding: 0 10px;
    .title{
        font-size: 20px;
        text-align: center;
        margin: 15px 0;
    }
    .subTitle{
        font-size: 13px;
        color: gray;
        display: flex;
        justify-content: space-between;
    }
    .content{}
    img {
        width: 100%;
        height: 100%;
    }
}
</style>